package com.hspedu.newData.力扣周赛.周赛.第448;

import org.junit.Test;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-04 
 * @Version: 1.0
 */

public class LC100659两个数字的最大乘积 {

    public int maxProduct(int n) {
        String s = n + "";

        int max1 = Integer.MIN_VALUE;
        int max2 = Integer.MIN_VALUE;

        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) - '0' >= max1){
                int temp = max1;
                max1 = s.charAt(i) - '0';
                max2 = temp;
            }else {
                max2 = Math.max(max2,s.charAt(i) - '0');
            }
        }
        return max1*max2;
    }

    @Test
    public void test() {
        // 测试代码

        int i = maxProduct(31);
        System.out.println("=======");

    }
}
